`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date:    00:32:48 05/02/2014 
// Design Name: 
// Module Name:    start_screen 
// Project Name: 
// Target Devices: 
// Tool versions: 
// Description: 
//
// Dependencies: 
//
// Revision: 
// Revision 0.01 - File Created
// Additional Comments: 
//
//////////////////////////////////////////////////////////////////////////////////
module start_screen(enable,blank,hcount,vcount,clk,rst,sprite,splash_border,pixel_color);
	//////////////////////////////////////////////////////////////////////////////////
	input clk,rst,blank,enable;
	input [10:0] hcount,vcount;
	//////////////////////////////////////////////////////////////////////////////////
	output [7:0] pixel_color;
	output	sprite,splash_border;
	//////////////////////////////////////////////////////////////////////////////////
	wire [7:0] pixel_color;

	reg [11:0] 	tile_address;

	parameter Xsprite = 7*32;
	parameter Ysprite = 7*32;

	splash splashy_sploosh(
		.clka(clk), // input clka
		.wea(1'b0), // input [0 : 0] wea
		.addra(tile_address), // input [11 : 0] addra
		.dina(8'd0), // input [7 : 0] dina
		.douta(pixel_color) // output [7 : 0] dout
	);
	

	always @ (posedge clk) begin
		if (rst) tile_address <= 0;
		else if (sprite) begin
			if(tile_address < 3599) tile_address <= tile_address + 1'b1;
			else tile_address <= 0;
		end
	end

	assign sprite = enable & ~blank & (hcount >= Xsprite & hcount <= Xsprite+89 & vcount >= Ysprite & vcount <= Ysprite+39);
	assign splash_border = enable & ~blank & (hcount >= 32 & hcount <= 480 & vcount >= Ysprite-60 & vcount <= Ysprite+100);
	
endmodule
